#!/usr/bin/env python
"""
# -*- coding: utf-8 -*-
# @Time    : 2020/10/22 17:11
# @Author  : AshJo
# @Desc    : HTTP服务端
# @Filename: socket_server.py
# @Version : v1.0
"""

import socket

sk = socket.socket()
sk.bind(('127.0.0.1', 9000))
sk.listen(2)

while True:
    conn, addr = sk.accept()

    from_browser_msg = conn.recv(1024).decode('utf-8')
    print(from_browser_msg)

    conn.send(b'HTTP/1.1 200 ok\r\n\r\n')
    with open('test.html', 'rb') as f:
        data = f.read()
    conn.send(data)
    conn.close()

# sk.close()
